package com.litchishell.feartures.main;

import com.litchishell.feartures.dao.BufferedReaderProcessor;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

/**
 * @author LitchiShell
 * @description:
 * @create 2021-11-20
 */
public class ProcessFile {
    public static String processFile(BufferedReaderProcessor p) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new FileReader("data.txt"));
        return p.process(bufferedReader);
    }

    public static void main(String[] args) {
        try {
            String s = processFile((BufferedReader b) -> b.readLine());
            String s1 = processFile((BufferedReader b) -> b.readLine() + b.readLine());
            System.out.println(s);
            System.out.println(s1);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
